package com.hillky.emos.wx.config;

import com.hillky.emos.wx.config.xss.XssFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.servlet.Filter;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    /**
     * 注册XssFilter
     */
    @Bean
    public FilterRegistrationBean<Filter> registerXssFilter() {
        FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>();
        registration.setFilter(new XssFilter());
        registration.setName(XssFilter.class.getSimpleName());
        registration.setOrder(1);
        return registration;
    }
}

